package com.wu.family.feed;

import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;

import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONObject;

import com.idle.view.CollapsibleTextView;
import com.idle.view.ProgressAroundView;
import com.wu.family.MainGroupActivity;
import com.wu.family.R;
import com.wu.family.alarm.AlarmDialogActivity;
import com.wu.family.config.Constant;
import com.wu.family.config.DeviceInfo;
import com.wu.family.config.HttpService;
import com.wu.family.config.Urls;
import com.wu.family.config.UserInfo;
import com.wu.family.dailytopic.SpaceWaterfallActivity;
import com.wu.family.feed.FeedDelCmtTask.OnTaskListener;
import com.wu.family.model.AlarmModel;
import com.wu.family.model.Audio;
import com.wu.family.model.AudioPhoto;
import com.wu.family.model.PublishModel;
import com.wu.family.model.RecomFeedMsg;
import com.wu.family.model.RepostFeed;
import com.wu.family.model.User;
import com.wu.family.model.UserComment;
import com.wu.family.more.MoreFamilyCardActivity;
import com.wu.family.more.MoreFamilyListSelectActivity;
import com.wu.family.publish.PublishActivity;
import com.wu.family.utils.BitmapTools;
import com.wu.family.utils.DisplayUtil;
import com.wu.family.utils.NetHelper;
import com.wu.family.utils.ProgressAroundViewUtil;
import com.wu.family.utils.TimeUtil;
import com.wu.family.utils.TipsUtil;
import com.wu.family.utils.ToastUtil;
import com.wu.family.utils.audio.SoundMgr;
import com.wu.family.utils.audio.SoundPlayer;
import com.wu.family.utils.img.AbsBitmapMgr2;
import com.wu.family.utils.img.AbsBitmapMgr2.ImageCallBack;
import com.wu.family.utils.img.BitmapMgrImpl;
import com.wu.family.utils.img.BitmapMgrImpl2;
import com.wu.family.utils.json.MapBean;
import com.wu.family.utils.json.StringUtil;
import com.wu.family.utils.ze.LoadAvatarBmpMgr;
import com.wu.family.views.CustomDialog;
import com.wu.family.views.PinnedHeaderListView.PinnedHeaderAdapter;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnCancelListener;
import android.content.DialogInterface.OnShowListener;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.text.ClipboardManager;
import android.text.Html;
import android.text.Spanned;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnLongClickListener;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.view.animation.AnimationUtils;
import android.view.inputmethod.InputMethodManager;
import android.widget.BaseAdapter;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ImageView.ScaleType;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

public class FeedListAdapter extends BaseAdapter implements PinnedHeaderAdapter{

	private LayoutInflater mInflater;
	private Activity context;
	private List<Map<String, Object>> mListItems;
	private int newFeedNum; 
	private Animation outAnimation;
	private Animation inAnimation;
	private Drawable deleteDrawable;
	private Drawable repostDrawable;
	private boolean isHeaderVisible = true;
	private boolean isLocalPic = false;
	private final int  TYPE_COUNT = 6;
	OnRepostMenuClick onRepostMenuClick;
	OnCommentInterface onCommentInterface = null;
	public interface OnCommentInterface{
		void onComment(Map<String, Object> map, String hint, String cacheCmt );
		void onReplyComment(Map<String, Object> map, UserComment userComment, String hint, String cacheCmt);
	}
	
	public FeedListAdapter(Activity context, List<Map<String, Object>> data){
		this.mInflater = LayoutInflater.from(context);
		this.context = context;
		this.mListItems = data;
		inAnimation = AnimationUtils.loadAnimation(context, R.anim.push_right_in500);
		outAnimation = AnimationUtils.loadAnimation(context, R.anim.push_right_out500);
		repostDrawable = context.getResources().getDrawable(R.drawable.feed_btn_repost);
		deleteDrawable = context.getResources().getDrawable(R.drawable.feed_btn_delete);
		
		repostDrawable.setBounds(new Rect(0, 0, DisplayUtil.dip2px(context, 23), DisplayUtil.dip2px(context, 16)));//42, 30
		deleteDrawable.setBounds(new Rect(0, 0, DisplayUtil.dip2px(context, 23), DisplayUtil.dip2px(context, 16)));
	}
	
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return (mListItems != null) ? mListItems.size(): 0;
	}

	@Override
	public Object getItem(int arg0) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}
	@Override
	public int getViewTypeCount() {
		// TODO Auto-generated method stub
		return TYPE_COUNT;
	}
	@Override
	public int getItemViewType(int position) {
		// TODO Auto-generated method stub
		if( position < mListItems.size() ){
			
			
			String idtype = (String) mListItems.get(position).get("idtype");
			if( idtype.contains("eventid") || idtype.contains("blogid")
			|| idtype.contains("photoid") || idtype.contains("videoid") ){
				// 2,3,4,5
				if( idtype.contains("photoid")){
					int picnum = (Integer)mListItems.get(position).get("picnum");
					if( picnum == 1 ){
						return 2;
					}else if( picnum > 1 ){
						return 3;
					}else if( ((String)mListItems.get(position).get("image_1")).contains("http://") ){
						return 2;
					}else {
						return 2;
					}
				}else if (idtype.contains("eventid") ) {
					return 5;
				}else if (idtype.contains("blogid") ) {
					if (  ( (String)mListItems.get(position).get("image_1")).contains("http://") 
						|| (idtype.contains("re") || 
					(mListItems.get(position).get("issubscribe")!=null && 
							mListItems.get(position).get("issubscribe").equals("1")))	){
						return 5;
					}else
					{
						return 2;
					}
				}else
				{
					return 5;
				}
					
			}else
			{
				// 0,1
				if( idtype.contains(Constant.IdType.NOTICE_ID) )
				{
					return 1;
				}else {
					return 0;
				}
			}
		}
		return 4;
	}
	public void setOnRepostMenuClick(OnRepostMenuClick onRepostMenuClick) {
		this.onRepostMenuClick = onRepostMenuClick;
	}
	public void setOnCommentInterface(OnCommentInterface onCommentInterface) {
		this.onCommentInterface = onCommentInterface;
	}
	public void setNewFeedNum(int newFeedNum) {
		this.newFeedNum = newFeedNum;
		notifyDataSetChanged();
	}
	public void setHeaderVisible(boolean isHeaderVisible) {
		this.isHeaderVisible = isHeaderVisible;
	}
	public void sendComment(Map<String, Object> map, String message, Audio audio){
		if (audio == null) {
			new postCommentTask(map,message).execute();
		}else {
			new postCommentTask(map,message, 
					audio.getAudioTime(), audio.getAudioPath()).execute();
		}
		
	}
	@Override
	public View getView(final int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		ViewHolderRoot holder = null;
		final Map<String, Object> map = mListItems.get(position);
		PublishModel publishModel = (PublishModel)map.get("publishModel");
		if (publishModel != null) {
			String id = publishModel.getId();
			if (!id.equals("")) {
				map.put("id", id);
			}
		}
		int type = getItemViewType(position);
		if(convertView == null){
			switch (type) {
			case 0:
				convertView = mInflater.inflate(R.layout.v2_3_feed_item_0, null);
				// anythings else
				holder = new ViewHolder_0();
				((ViewHolder_5)holder).ivComtPhoto = (ImageView) convertView.findViewById( R.id.ivComtPhoto );
				break;
			case 1:
				convertView = mInflater.inflate(R.layout.v2_3_feed_item_1, null); 
				// notice
				holder = new ViewHolder_1();
				((ViewHolder_5)holder).ivComtPhoto = (ImageView) convertView.findViewById( R.id.ivComtPhoto );
				break;
			case 2:
				convertView = mInflater.inflate(R.layout.v2_3_feed_item_2, null); 
				// picone
				holder = new ViewHolder_2();
				// pic-1
				((ViewHolder_2)holder).ivPic = (ImageView)convertView.findViewById( R.id.ivItempic );
				((ViewHolder_2)holder).tvItemContent = (TextView) convertView.findViewById( R.id.tvItemContent );
				((ViewHolder_2)holder).llPics = (LinearLayout) convertView.findViewById( R.id.llPics );
				((ViewHolder_2)holder).progArdView = (ProgressAroundView) convertView.findViewById( R.id.btnPlayOrPause );
				break;
			case 3:
				convertView = mInflater.inflate(R.layout.v2_3_feed_item_3, null); 
				// picmore
				holder = new ViewHolder_3();
				((ViewHolder_3)holder).ivpics = new ImageView[9];
				((ViewHolder_3)holder).ivpics[0] = (ImageView)convertView.findViewById( R.id.item3pic );
				((ViewHolder_3)holder).ivpics[1] = (ImageView)convertView.findViewById( R.id.item3pic2 );
				((ViewHolder_3)holder).ivpics[2] = (ImageView)convertView.findViewById( R.id.item3pic3 );
				((ViewHolder_3)holder).ivpics[3] = (ImageView)convertView.findViewById( R.id.item3pic4 );
				((ViewHolder_3)holder).ivpics[4] = (ImageView)convertView.findViewById( R.id.item3pic5 );
				((ViewHolder_3)holder).ivpics[5] = (ImageView)convertView.findViewById( R.id.item3pic6 );
				((ViewHolder_3)holder).ivpics[6] = (ImageView)convertView.findViewById( R.id.item3pic7 );
				((ViewHolder_3)holder).ivpics[7] = (ImageView)convertView.findViewById( R.id.item3pic8 );
				((ViewHolder_3)holder).ivpics[8] = (ImageView)convertView.findViewById( R.id.item3pic9 );
				((ViewHolder_3)holder).tvItemContent = (TextView) convertView.findViewById( R.id.tvItemContent );
				((ViewHolder_3)holder).llPics = (LinearLayout) convertView.findViewById( R.id.llPics );
				break;	
//			case 4:
//				convertView = mInflater.inflate(R.layout.v2_3_feed_item_4, null); 
//				// pic0
//				holder = new ViewHolder_4();
//				break;
			case 5:
				convertView = mInflater.inflate(R.layout.v2_3_feed_item_5, null); 
				holder = new ViewHolder_5();
				((ViewHolder_5)holder).ivPic = (ImageView) convertView.findViewById( R.id.item1pic );
				((ViewHolder_5)holder).tvItemFname = (TextView) convertView.findViewById( R.id.item1tvFname );
				((ViewHolder_5)holder).tvTvTitle = (TextView) convertView.findViewById( R.id.item1tvTitle );
				((ViewHolder_5)holder).tvItemContent = (TextView) convertView.findViewById( R.id.item1tvContent );
				((ViewHolder_5)holder).llPics = (LinearLayout) convertView.findViewById( R.id.item1llPics );
				break;
			}
			holder.llFeedDate = (LinearLayout) convertView.findViewById( R.id.llFeedDate );
			holder.tvFeedDate = (TextView) convertView.findViewById( R.id.tvFeedDate );
			holder.tvNoticeNum = (TextView) convertView.findViewById( R.id.tvNoticeNum );
			holder.ivAvatar = (ImageView) convertView.findViewById( R.id.avatar );
			holder.ivVip = (ImageView)convertView.findViewById(R.id.ivVip);
//			holder.rlUserInfo = (RelativeLayout) convertView.findViewById( R.id.rlUserInfo );
			holder.tvTvUserName = (TextView) convertView.findViewById( R.id.tvUserName );
			holder.tvTvTime = (TextView) convertView.findViewById( R.id.tvTime );
			holder.tvTvContent = (CollapsibleTextView) convertView.findViewById( R.id.tvContent );
			holder.tvNewNum = (TextView) convertView.findViewById( R.id.tvNewNum );
			//**************************
			holder.tvDetail  = (TextView) convertView.findViewById( R.id.tvDetail );
			holder.tvDelete  = (TextView) convertView.findViewById( R.id.tvDelete );
			holder.tvFeedTittle = (TextView) convertView.findViewById( R.id.tvFeedTittle );
			holder.llRepostPart = (LinearLayout) convertView.findViewById( R.id.llRepostPart );
			holder.tvTvFname = (TextView) convertView.findViewById( R.id.tvFname );
			holder.tvFoldState = (TextView) convertView.findViewById( R.id.tvFoldState );
			holder.llLlContent = (LinearLayout) convertView.findViewById( R.id.LlContent );
			holder.tvCome = (TextView) convertView.findViewById( R.id.tvCome );
			holder.rlMoreMenu = (RelativeLayout) convertView.findViewById( R.id.rlMoreMenu );
			holder.llAlbumName = (LinearLayout) convertView.findViewById( R.id.llAlbumName );
			holder.tvTvAlbumName = (TextView) convertView.findViewById( R.id.tvAlbumName );
			holder.ivIvShowMore = (ImageView) convertView.findViewById( R.id.ivShowMore );
			holder.llLlHidedMenu = (LinearLayout) convertView.findViewById( R.id.llHidedMenu );
			holder.tvRepostNum = (TextView) convertView.findViewById( R.id.repostNum );
			holder.tvLikeitNum = (TextView) convertView.findViewById( R.id.likeitNum );
			holder.tvCommentNum = (TextView) convertView.findViewById( R.id.commentNum );
			holder.tvTvLoveUsers = (TextView) convertView.findViewById( R.id.tvCommentTips );
			holder.tvCommentMark = (TextView) convertView.findViewById( R.id.tvCommentMark );
			holder.llSplitLine = (LinearLayout) convertView.findViewById( R.id.llSplitLine );
			holder.llLlComments = (LinearLayout) convertView.findViewById( R.id.llComments );
			
			convertView.setTag(holder);
		}else
		{
			switch (type) {
			case 0:
				holder = (ViewHolder_0) convertView.getTag();
				break;
			case 1:
				holder = (ViewHolder_1) convertView.getTag();
				break;
			case 2:
				holder = (ViewHolder_2) convertView.getTag();
				break;
			case 3:
				holder = (ViewHolder_3) convertView.getTag();
				break;	
//			case 4:
//				holder = (ViewHolder_4) convertView.getTag();
//				break;
			case 5:
				holder = (ViewHolder_5) convertView.getTag();
				break;
			}
		}
			final String idtype = (String)map.get("idtype");
			holder.tvDelete = holder.tvTvContent.getAdditionalTextView();
			holder.tvDelete.setText("删除");
			holder.tvNewNum.setVisibility(View.GONE);
			if (map.get("date") != null) {
				final String date = (String)map.get("date");
				holder.llFeedDate.setVisibility(View.VISIBLE);
				holder.tvFeedDate.setText(date.contains("-")?TimeUtil.transDate(date)
						:TimeUtil.transDate(Integer.parseInt(date)));
				String calendarnum = (String)map.get("calendarnum");
				if (calendarnum !=null && !calendarnum.equals("0")) {
					holder.tvNoticeNum.setText((String)map.get("calendarnum"));
					holder.tvNoticeNum.setVisibility(View.VISIBLE);
					holder.tvNoticeNum.setOnClickListener(new OnClickListener() {
						@Override
						public void onClick(View v) {
							MainGroupActivity.startToCalendar(date);
						}
					});
				}else
				{
					holder.tvNoticeNum.setVisibility(View.GONE);
					holder.tvNoticeNum.setOnClickListener(null);
					holder.tvFeedDate.setOnClickListener(null);
				}
				if (position > 0) {
					final Map<String, Object>  map2 = mListItems.get(position-1);
					if (map.get("date").equals(map2.get("date"))) {
						holder.llFeedDate.setVisibility(View.GONE);
					}else {
					}
				}
				holder.tvFeedDate.setOnClickListener(new OnClickListener() {
					@Override
					public void onClick(View v) {
						/*Intent intent = new Intent(ctxOfActivity, CalendarActivity.class);
						intent.putExtra("date", date);
						ctxOfActivity.startActivity(intent);*/
						MainGroupActivity.startToCalendar(date);
					}
				});
			}else{
				holder.llFeedDate.setVisibility(View.GONE);
			}
			if (!isHeaderVisible) {
				holder.llFeedDate.setVisibility(View.GONE);
			}
			if (idtype.contains("eventid") || idtype.contains("blogid")
					|| idtype.contains("photoid") || idtype.contains("videoid")) {
//				holder.llLlContent.removeAllViews();
				holder.ivAvatar.setImageBitmap(LoadAvatarBmpMgr.getInstance().loadBitmap((String)map.get("avatarPath"), 
						holder.ivAvatar, null));
				holder.tvTvUserName.setText((String)map.get("name"));
				holder.tvFeedTittle.setText((String)map.get("title"));
				holder.tvTvFname.setText((String)map.get("fname"));
				holder.tvTvTime.setText(TimeUtil.transTime2((Integer)map.get("dateline")));
				holder.tvTvContent.setText((String)map.get("message"));
				holder.tvTvContent.setVisibility(View.VISIBLE);
				holder.tvTvContent.resetDefaultState();
				holder.tvCome.setText("来自：" +(String)map.get("come"));
				holder.tvFoldState.setVisibility(View.GONE);
				String vipstatus = (String)map.get("vipstatus");
				if (!vipstatus.equals("")) {
					holder.ivVip.setVisibility(View.VISIBLE);
					holder.ivVip.setSelected(vipstatus.equals("family")?true:false);
				}else {
					holder.ivVip.setVisibility(View.GONE);
				}
				if (idtype.contains("re")) {
					holder.llRepostPart.setVisibility(View.GONE);
					if (!((String)map.get("message")).equals("")) {
						holder.tvTvContent.setVisibility(View.VISIBLE);
					}
				}else {
					holder.llRepostPart.setVisibility(View.GONE);
				}
				int picnum = (Integer)map.get("picnum");
				if (idtype.contains("photoid")){
					if (!((String)map.get("message")).equals("")) {
						holder.tvTvContent.setVisibility(View.VISIBLE);
					}
					if (picnum == 1) {
						setOnePicView(map, idtype.contains("re"), position, 
								((ViewHolder_2)holder).ivPic, 
								((ViewHolder_2)holder).tvItemContent, 
								((ViewHolder_2)holder).progArdView, ((ViewHolder_2)holder).llPics,
								holder.llLlContent);
					}else if( picnum >= 2){
						setMorePicView(map, picnum, idtype.contains("re"),
								((ViewHolder_3)holder).ivpics, 
								((ViewHolder_3)holder).llPics,
								((ViewHolder_3)holder).tvItemContent,
								holder.llLlContent);
					}else if (((String)map.get("image_1")).contains("http://")){
						setOnePicView(map, idtype.contains("re"), position, 
								((ViewHolder_2)holder).ivPic, 
								((ViewHolder_2)holder).tvItemContent, 
								((ViewHolder_2)holder).progArdView, ((ViewHolder_2)holder).llPics,
								holder.llLlContent);
					}else
					{
						holder.llLlContent.setVisibility(View.GONE);
						setOnePicView(map, idtype.contains("re"), position, 
								((ViewHolder_2)holder).ivPic, 
								((ViewHolder_2)holder).tvItemContent, 
								((ViewHolder_2)holder).progArdView, ((ViewHolder_2)holder).llPics,
								holder.llLlContent);
					}
				}else if (idtype.contains("eventid")) {
					setLeftPicView(map, idtype.contains("re"), position,
							((ViewHolder_5)holder).ivPic,
							((ViewHolder_5)holder).tvItemFname,
							((ViewHolder_5)holder).tvTvTitle,
							((ViewHolder_5)holder).tvItemContent,
							((ViewHolder_5)holder).llPics,
							holder.llLlContent);
				}else if( idtype.contains("blogid") ){
					if (((String)map.get("image_1")).contains("http://")){
						setLeftPicView(map, idtype.contains("re"), position,
								((ViewHolder_5)holder).ivPic,
								((ViewHolder_5)holder).tvItemFname,
								((ViewHolder_5)holder).tvTvTitle,
								((ViewHolder_5)holder).tvItemContent,
								((ViewHolder_5)holder).llPics,
								holder.llLlContent);
					}else if (idtype.contains("re") || 
							(map.get("issubscribe")!=null && map.get("issubscribe").equals("1"))) {
						setLeftPicView(map, idtype.contains("re"), position,
								((ViewHolder_5)holder).ivPic,
								((ViewHolder_5)holder).tvItemFname,
								((ViewHolder_5)holder).tvTvTitle,
								((ViewHolder_5)holder).tvItemContent,
								((ViewHolder_5)holder).llPics,
								holder.llLlContent);
					}else {
						// 隐藏图片的部分
						holder.llLlContent.setVisibility(View.GONE);
					}
					if (map.get("issubscribe")!=null && map.get("issubscribe").equals("1")) {
						holder.tvTvContent.setText("分享了一篇新文章");
						holder.tvTvContent.setVisibility(View.VISIBLE);
					}
				}else {
					setLeftPicView(map, idtype.contains("re"), position,
							((ViewHolder_5)holder).ivPic,
							((ViewHolder_5)holder).tvItemFname,
							((ViewHolder_5)holder).tvTvTitle,
							((ViewHolder_5)holder).tvItemContent,
							((ViewHolder_5)holder).llPics,
							holder.llLlContent);
				}
				holder.tvTvAlbumName.setText((String)map.get("tagname"));
				if (UserInfo.getInstance(context).getUid().equals((String)map.get("uid"))){
					holder.tvDelete.setVisibility(View.VISIBLE);
				}else {
					holder.tvDelete.setVisibility(View.GONE);
				}
				
				if (((String)map.get("mylove")).equals("1")) {
					holder.tvLikeitNum.setSelected(true);
				}else {
					holder.tvLikeitNum.setSelected(false);
				}
				
				holder.llSplitLine.setVisibility(View.VISIBLE);
				holder.llLlComments.removeAllViews();
				if ((Integer)map.get("commentnum") == 0) {
					holder.tvCommentMark.setVisibility(View.GONE);
					holder.tvTvLoveUsers.setVisibility(View.GONE);
					holder.llSplitLine.setVisibility(View.GONE);
					holder.llLlComments.setVisibility(View.GONE); 
				}else if ((Integer)map.get("commentnum") >= 1) {
					holder.tvCommentMark.setVisibility(View.VISIBLE);
					holder.tvTvLoveUsers.setVisibility(View.VISIBLE);
					holder.llLlComments.setVisibility(View.VISIBLE);
					holder.llLlComments.addView(getCommentsView(map, (ArrayList<UserComment>) map.get("UserCommentList"), position));
				}
				
				String loveuserNames = "";
				final String loveuserArr[];
				final String loveuserIdArr[];
				
				List<MapBean> loveuserMap = (List<MapBean>)map.get("loveuser");
				if (loveuserMap != null && loveuserMap.size() > 0) {
					int size = loveuserMap.size();
					loveuserArr = new String[size];
					loveuserIdArr = new String[size];
					for (int i = 0; i < size; i++) {
						MapBean mapBean = loveuserMap.get(i);
						loveuserNames = loveuserNames + (String)mapBean.get("name") + ((i!=loveuserMap.size()-1)?",":"");
						loveuserArr[i] = (String)mapBean.get("name");
						loveuserIdArr[i] = (String)mapBean.get("uid");
					}
					holder.tvCommentMark.setVisibility(View.VISIBLE); 
					holder.tvTvLoveUsers.setVisibility(View.VISIBLE);
					
					holder.tvTvLoveUsers.setOnClickListener(new OnClickListener() {
						@Override
						public void onClick(View v) {
							new AlertDialog.Builder(context).setItems( 
									loveuserArr, new DialogInterface.OnClickListener() {
										@Override
										public void onClick(DialogInterface dialog, int which) {
											Intent intent = new Intent(context, MoreFamilyCardActivity.class);
											intent.putExtra("uid", loveuserIdArr[which]);
											context.startActivity(intent);
										}
									}).setNeutralButton(R.string.dialog_button_close, null).create().show(); 
						}
					});
				}else {
					holder.tvTvLoveUsers.setVisibility(View.GONE); 
					holder.llSplitLine.setVisibility(View.GONE); 
				}
				holder.tvTvLoveUsers.setText(loveuserNames);
				holder.llAlbumName.setOnClickListener(new OnClickListener() {
					@Override
					public void onClick(View v) {
						Intent intent = new Intent(context, SpaceWaterfallActivity.class);//SpaceDetailActivity
						intent.putExtra("uid", (String)map.get("uid"));
						intent.putExtra("tagid", (String)map.get("tagid"));
						intent.putExtra("tagname", (String)map.get("tagname"));
						context.startActivity(intent);
					}
				});
			}else
			{
				// not pic event blog video
				((ViewHolder_5)holder).ivComtPhoto.setVisibility(View.GONE);
				holder.tvTvUserName.setVisibility(View.VISIBLE);
				ArrayList<String> tempItems = new ArrayList<String>();
				tempItems.add((String)map.get("name"));
				if (idtype.contains("isayid")) {
					Spanned  content = Html.fromHtml("<font color=\"#797979\">"+ "说了句 " + "</font>"
					        + "<font color=\"#000000\">" +(String)map.get("message") + "</font>");
					
					holder.tvTvContent.setText(content);
				}else if (idtype.contains("eventcomment") || idtype.contains("blogcomment")
						|| idtype.contains("photocomment") || idtype.contains("videocomment")) {
					holder.ivAvatar.setImageBitmap(LoadAvatarBmpMgr.getInstance().loadBitmap((String)map.get("cavatar"), 
							holder.ivAvatar,null));
					AvatarClickListener avatarClickListener2 = new AvatarClickListener((String)map.get("cuid"));
					holder.ivAvatar.setOnClickListener(avatarClickListener2);
					holder.tvTvUserName.setOnClickListener(avatarClickListener2);
					
					holder.tvTvUserName.setText((String)map.get("cname"));
					String cvipstatus = (String)map.get("cvipstatus");
					if (!cvipstatus.equals("")) {
						holder.ivVip.setVisibility(View.VISIBLE);
						holder.ivVip.setSelected(cvipstatus.equals("family")?true:false);
					}else {
						holder.ivVip.setVisibility(View.GONE);
					}
					Spanned  content = Html.fromHtml("<font color=\"#9ED54B\">" +(String)map.get("cname") + "</font> " 
							+ "<font color=\"#797979\">"+ "评论了" + "</font>"
					        + "<font color=\"#9ED54B\">" +(String)map.get("name") + "</font>" 
							+ "<font color=\"#797979\">" + (String)map.get("title") + "</font>"
							+ "<font color=\"red\">"+"《"+(String)map.get("subject")+"》" + "</font>" );
					
					holder.tvTvContent.setText(content);
					if (((String)map.get("image_1")).contains("http://")){
						((ViewHolder_5)holder).ivComtPhoto.setVisibility(View.VISIBLE);
						((ViewHolder_5)holder).ivComtPhoto.setImageBitmap(BitmapMgrImpl.getInstance().loadBitmap((String)map.get("image_1"), 
								((ViewHolder_5)holder).ivComtPhoto, BitmapMgrImpl.getInstance().feedCallBack));
						/*holder.ivComtPhoto.setImageBitmap((Bitmap)map.get("image1"));*/
					}
					tempItems.add((String)map.get("cname"));
					tempItems.add(((String)map.get("title")).replace("的", "") + "详情");
				}else if (idtype.contains("friend")) {
					Spanned  content = Html.fromHtml("<font color=\"#797979\">"+ "和" + "</font>"
					        + "<font color=\"#9ED54B\">" +(String)map.get("fname") + "</font>" 
							+ "<font color=\"#797979\">" + (String)map.get("subject") + "</font>");
					holder.tvTvContent.setText(content);
					tempItems.add((String)map.get("fname"));
				}else if (idtype.contains(Constant.IdType.NOTICE_ID)){
					holder.tvTvContent.setText("提醒");
					setNoticeView(map, idtype.contains("re"), position,
							((ViewHolder_1)holder).ivPic, 
							((ViewHolder_1)holder).tvItemFname, 
							((ViewHolder_1)holder).tvTvTitle, 
							((ViewHolder_1)holder).tvItemContent, 
							((ViewHolder_1)holder).llPics, 
							((ViewHolder_1)holder).llLlContent);
				}else { //创建家 更新信息 更新头像
					holder.tvTvContent.setText(((String)map.get("title")).replace("&nbsp;", " "));
				}
				final String items[] = new String[tempItems.size()];
				for (int i = 0; i < tempItems.size(); i++) {
					items[i] = tempItems.get(i);
				}
				
			}
			holder.tvTvAlbumName.setVisibility(View.VISIBLE);
			holder.llLlHidedMenu.setVisibility(View.GONE);
			AvatarClickListener avatarClickListener = new AvatarClickListener((String)map.get("uid"));
			holder.ivAvatar.setOnClickListener(avatarClickListener);
			//holder.ivAvatar2.setOnClickListener(avatarClickListener);
			holder.tvTvUserName.setOnClickListener(avatarClickListener);
			//holder.tvUserName2.setOnClickListener(avatarClickListener);
			holder.ivIvShowMore.setSelected(false); 
			holder.rlMoreMenu.setOnClickListener(null);
			final ViewHolderRoot fholder = holder;
			holder.ivIvShowMore.setOnClickListener(new OnClickListener() {
				@Override
				public void onClick(View v) {
					if (fholder.ivIvShowMore.isSelected()) {
						fholder.ivIvShowMore.setSelected(false); 
						//holder.tvTvAlbumName.setVisibility(View.VISIBLE);
						fholder.llLlHidedMenu.startAnimation(outAnimation);
						outAnimation.setAnimationListener(new AnimationListener() {
							@Override
							public void onAnimationStart(Animation animation) {
							}
							
							@Override
							public void onAnimationRepeat(Animation animation) {
							}
							
							@Override
							public void onAnimationEnd(Animation animation) {
								fholder.llLlHidedMenu.setVisibility(View.GONE);
							}
						});
					}else {
						fholder.ivIvShowMore.setSelected(true); 
						//holder.tvTvAlbumName.setVisibility(View.GONE);
						fholder.llLlHidedMenu.setVisibility(View.VISIBLE);
						fholder.llLlHidedMenu.startAnimation(inAnimation);
					}
				}
			});
			holder.tvRepostNum.setOnClickListener(new OnClickListener() {
				@Override
				public void onClick(View v) {
					if (((String)map.get("id")).equals("")) {
						ToastUtil.show(context, "亲！请等待发布完成再转载！");
						return;
					}
					String[] items = new String[] { "新浪微博", "微信好友", "微信朋友圈", "推荐给家人","转载到动态"};
					if(UserInfo.getInstance(context).getUid().equals((String)map.get("uid")) 
							|| idtype.contains("eventid")){
						items = new String[] { "新浪微博", "微信好友", "微信朋友圈", "推荐给家人"};
					}
					new AlertDialog.Builder(context).setItems(items,
							new DialogInterface.OnClickListener() {
						@Override
						public void onClick(DialogInterface dialog, int which) {
							RepostFeed repostFeed = new RepostFeed();
							repostFeed.setIdtype(idtype);
							repostFeed.setId((String)map.get("id"));
							User user = new User();
							user.setUid((String)map.get("uid"));
							user.setName((String)map.get("name"));
							repostFeed.setUser(user);
							
							repostFeed.setSubject((String)map.get("subject"));
							repostFeed.setMessage((String)map.get("message"));
							repostFeed.setTitle((String)map.get("title"));
							repostFeed.setLocation((String)map.get("location"));
							
							repostFeed.setClassid((String)map.get("classid"));
							repostFeed.setDetail((String)map.get("message"));
							
							ArrayList<String> photoUrls = new ArrayList<String>();
							for(int i= 1; i <= 9; i++){
								if((String)map.get("image_"+i)!=null && ((String)map.get("image_"+i)).contains("http://")){
									photoUrls.add((String)map.get("image_"+i));
								}
							}
							repostFeed.setPhotoUrls(photoUrls);
							repostFeed.setAudioPhoto((AudioPhoto)map.get("AudioPhoto"));
							
							if (which == 3) {
								RecomFeedMsg model = new RecomFeedMsg();
								model.setId((String)map.get("id"));
								model.setIdtype((String)map.get("idtype"));
								model.setFid((String)map.get("fid"));
								model.setUid((String)map.get("uid"));
								model.setImgurl((String)map.get("image_1"));
								model.setSubject((String)map.get("subject"));
								model.setAvatar((String)map.get("avatarPath"));
								model.setVipstatus((String)map.get("vipstatus"));
								
								Intent intent = new Intent(context, MoreFamilyListSelectActivity.class);
								intent.putExtra("RecomFeedModel", model);
								context.startActivity(intent);
							}else if (which == 4) {
								Intent intent = new Intent(context, PublishActivity.class);
								intent.putExtra("idtype", idtype);
								intent.putExtra("RepostFeed", repostFeed);
								context.startActivity(intent);
							}else if (which == 0){
								if (onRepostMenuClick != null) {
									onRepostMenuClick.onShareToWeibo(repostFeed);
								}
							}else if (which == 1){
								if (onRepostMenuClick != null) {
									onRepostMenuClick.onShareToWXFriend(repostFeed);
								}
							}else if (which == 2){
								if (onRepostMenuClick != null) {
									onRepostMenuClick.onShareToWXFriCircle(repostFeed);
								}
							}
							
						}
					}).create().show(); 
					
				}
			});
			holder.tvLikeitNum.setOnClickListener(new OnClickListener() {
				@Override
				public void onClick(View v) {
					String id = (String)map.get("id");
					if (id.equals("")) {
						return;
					}
					fholder.tvLikeitNum.setSelected(!((String)map.get("mylove")).equals("1"));
					new postCollectFeedTask(map, fholder.tvLikeitNum).execute(); 
				}
			});
			holder.tvCommentNum.setOnClickListener(new OnClickListener() {
				@Override
				public void onClick(View v) {
					String id = (String)map.get("id");
					if (id.equals("")) {
						return;
					}
					if (idtype.contains(Constant.IdType.EVENT_ID)) {
						AlertDialog dialog = new AlertDialog.Builder(context).setTitle(context.getResources().getString(R.string.dialog_title_jionevent)).
								setNegativeButton(context.getString(R.string.dialog_button_cancel), null).
								setPositiveButton(context.getResources().getString(R.string.dialog_button_jion), new DialogInterface.OnClickListener() {
									@Override
									public void onClick(DialogInterface dialog, int which) {
										new postAttendActTask(map, "").execute();	
									}
								}).create();
						
						dialog.show();
					}else {
						//TODO
						String lastcmsg = (String)map.get("lastcmsg");
						if (onCommentInterface != null) {
							onCommentInterface.onComment(map, "评论", lastcmsg==null?"":lastcmsg);
							return;
						}
						
						final EditText editText = new EditText(context);
						   editText.setHint(context.getResources().getString(R.string.dialog_hint_comment) );
						   editText.setGravity(Gravity.TOP);
						   editText.setHeight(DisplayUtil.dip2px(context, 188));
						   editText.setBackgroundColor(Color.parseColor("#00000000"));
						   editText.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
						   editText.setTextSize(16);
						   editText.setText(lastcmsg==null?"":lastcmsg);
						   editText.requestFocus();
						   editText.requestFocusFromTouch();
						   CustomDialog dialog = new CustomDialog.Builder(context).setView(editText)
								   .setNegativeButton("", new DialogInterface.OnClickListener() {
									@Override
									public void onClick(DialogInterface dialog,
											int which) {
										String lastcmsg = editText.getText().toString().trim();
										map.put("lastcmsg", lastcmsg);
										notifyDataSetChanged();
									}})
								   .setPositiveButton("", new DialogInterface.OnClickListener() {
									@Override
									public void onClick(DialogInterface dialog, int which) {
										String message = editText.getText().toString().trim();
										if (!message.equals("")) {
											map.put("lastcmsg", "");
											new postCommentTask(map,message).execute();
										}else {
											Toast.makeText(context, R.string.dialog_hint_comment, Toast.LENGTH_SHORT).show();
										}
									}
								}).create();
						   dialog.setOnShowListener(new OnShowListener() {

							    @Override
							    public void onShow(DialogInterface dialog) {
							        InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
							        if (imm != null) {
							        	imm.showSoftInput(editText, InputMethodManager.SHOW_IMPLICIT);
									}
							    }
							});

						dialog.setOnCancelListener(new OnCancelListener() {
							
							@Override
							public void onCancel(DialogInterface dialog) {
								String lastcmsg = editText.getText().toString().trim();
								map.put("lastcmsg", lastcmsg);
								notifyDataSetChanged();
							}
						});

						dialog.show();
					}
				}
			});
			
			holder.tvDelete.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View v) {
					new AlertDialog.Builder(context).setMessage("确认删除？")  
				        .setPositiveButton("确定", new DialogInterface.OnClickListener(){  
				            public void onClick(DialogInterface dialog, int whichButton) {
				            	new postDeleteDetailTask(idtype, (String)map.get("id"), position).execute();
				            }  
				        }).setNegativeButton("取消", null).show();
				}
			});
			if(holder.tvDetail == null){
				int ptype = getItemViewType(position);
				holder.tvDetail = null;
			}
			holder.tvDetail.setOnClickListener(new OnClickListener() {
				@Override
				public void onClick(View v) {
					String idtype = (String)map.get("idtype");
					if (idtype.contains("eventid") || idtype.contains("blogid")
							|| idtype.contains("photoid") || idtype.contains("videoid")) {
						String id = (String)map.get("id");
						if (!id.equals("")) {
							Intent intent = new Intent(context, FeedDetailActivity.class);
							intent.putExtra("id", (String)map.get("id"));
							intent.putExtra("idtype", (String)map.get("idtype"));
							intent.putExtra("uid", (String)map.get("uid"));
							intent.putExtra("position", position);
							context.startActivityForResult(intent, Constant.FEED_DELETE);
						}else if ((PublishModel)map.get("publishModel") != null) {
						}
					}
				}
			});
		return convertView;
	}

	@Override
	public int getPinnedHeaderState(int position) {
		// TODO Auto-generated method stub
		if (!isHeaderVisible) {
			return PINNED_HEADER_GONE;
		}
		//此针对有下拉刷新头部的listview 因为childview的数量 count = adapter.count + header.count
		if (position <= 1 || mListItems == null) {
			return PINNED_HEADER_GONE;
		}
		int mPosition = position - 2;
		
		if (mPosition < mListItems.size()-1 ) {
		    final Map<String, Object>  map = mListItems.get(mPosition);
			final Map<String, Object>  map2 = mListItems.get(mPosition+1);
			if (map.get("date") == null) {
				return PINNED_HEADER_GONE;
			}
			if (map.get("date").equals(map2.get("date"))) {
				return PINNED_HEADER_VISIBLE;
			}else {
				return PINNED_HEADER_PUSHED_UP;
			}
		}
		
		return PINNED_HEADER_VISIBLE;
	}

	@Override
	public void configurePinnedHeader(View header, int position) {
		// TODO Auto-generated method stub
		//此针对有下拉刷新头部的listview 因为childview的数量 count = adapter.count + header.count
		if (position <= 1 || mListItems == null) {
			return ;
		}
		int mPosition = position - 2;
		
		final Map<String, Object> map = mListItems.get(mPosition);
		if (map.get("date") == null) {
			return ;
		}
		String calendarnum = (String)map.get("calendarnum");
		if (calendarnum !=null && !calendarnum.equals("0")) {
			((TextView) header.findViewById(R.id.tvNoticeNum)).setText((String)map.get("calendarnum"));
			((TextView) header.findViewById(R.id.tvNoticeNum)).setVisibility(View.VISIBLE);
		}else {
			((TextView) header.findViewById(R.id.tvNoticeNum)).setVisibility(View.INVISIBLE);
		}
		String date = (String)map.get("date");
		((TextView) header.findViewById(R.id.tvSection)).setText(date.contains("-")?TimeUtil.transDate(date)
				:TimeUtil.transDate(Integer.parseInt(date)));
	}
	public boolean isLocalPic() {
		return isLocalPic;
	}
	public void setLocalPic(boolean isLocalPic) {
		this.isLocalPic = isLocalPic;
	}
	private void setNoticeView(final Map<String, Object> map, boolean isRepost, final int position,
			ImageView ivPic,TextView tvFname,TextView tvTvTitle,TextView tvTvContent,LinearLayout llPics,View view ){
		view.setVisibility(View.VISIBLE);
		tvFname.setVisibility(View.GONE);
		tvTvContent.setVisibility(View.GONE);
		
		if (((String)map.get("image_1")).contains("http://")) {
			ivPic.setVisibility(View.VISIBLE);
			
			ivPic.setImageBitmap(BitmapMgrImpl.getInstance().loadBitmap((String)map.get("image_1"), 
					ivPic, BitmapMgrImpl.getInstance().feedCallBack));
			
			ivPic.setOnClickListener(new PicClickListener(map,0));
		}else {
			ivPic.setVisibility(View.VISIBLE);
			ivPic.setImageResource(R.drawable.notice_feed_icon);
		}
		//TODO 
		AlarmModel model = (AlarmModel)map.get("AlarmModel");
		if (model!=null && model.getOutdated()) {
			tvTvTitle.setText((String)map.get("subject") +"(已过期)");
			tvTvTitle.setTextColor(Color.parseColor("#C4C4C4"));
		}else {
			tvTvTitle.setText((String)map.get("subject"));
		}		
		
		/*String message = (String)map.get("message");
		tvTvContent.setText(message);*/
		
		if (isRepost) {
			llPics.setBackgroundResource(R.drawable.btn_lightgray);
			tvTvContent.setVisibility(View.VISIBLE);
			tvFname.setVisibility(View.VISIBLE);
			
 			tvFname.setText((String)map.get("fname") +":" );
			tvTvTitle.setText((String)map.get("fsubject"));
			tvTvContent.setText((String)map.get("fmessage"));
			
			view.setOnClickListener(new OnClickListener() {
				@Override
				public void onClick(View v) {
					new AlertDialog.Builder(context).setItems( 
							new String[]{"原帖", (String)map.get("fname")}, new DialogInterface.OnClickListener() {
								@Override
								public void onClick(DialogInterface dialog, int which) {
									if (which == 0) {
										String idtype = (String)map.get("idtype");
										if (idtype.contains(Constant.IdType.NOTICE_ID) ) {
											String id = (String)map.get("fid");
											if (!id.equals("")) {
												Intent intent = new Intent(context, AlarmDialogActivity.class);
												intent.putExtra("id", (String)map.get("fid"));
												intent.putExtra("uid", (String)map.get("fuid"));
												intent.putExtra("calendarinfo", (MapBean)map.get("calendarinfo"));
												context.startActivity(intent);
											}
										}
									}else {
										Intent intent = new Intent(context, MoreFamilyCardActivity.class);
										intent.putExtra("uid", (String)map.get("fuid"));
										context.startActivity(intent);
									}
								}
							}).create().show(); 
				}
			});
		}else {
			llPics.setBackgroundResource(R.drawable.btn_lightgray);
			view.setOnClickListener(new OnClickListener() {
				@Override
				public void onClick(View v) {
					String idtype = (String)map.get("idtype");
					if (idtype.contains(Constant.IdType.NOTICE_ID)) {
						String id = (String)map.get("id");
						if (!id.equals("")) {
							Intent intent = new Intent(context, AlarmDialogActivity.class);
							intent.putExtra("id", (String)map.get("id"));
							intent.putExtra("uid", (String)map.get("uid"));
							intent.putExtra("calendarinfo", (MapBean)map.get("calendarinfo"));
							intent.putExtra("alarm", (AlarmModel)map.get("AlarmModel"));
							context.startActivity(intent);
						}
					}
				}
			});
		}
	};
	private View getCommentsView(final Map<String, Object> map, ArrayList<UserComment> userComments, final int position){
		LinearLayout layout = new LinearLayout(context);
		layout.setOrientation(LinearLayout.VERTICAL);
		for (UserComment userComment : userComments) {
			View view = mInflater.inflate(R.layout.feed_list_comment_item, null);
			RelativeLayout rlCommentOne = (RelativeLayout) view.findViewById( R.id.rlComment );
			TextView tvCommentName = (TextView) view.findViewById( R.id.tvCommentName );
			TextView tvComtContent = (TextView) view.findViewById( R.id.tvComtContent );
			TextView tvCommentTime = (TextView) view.findViewById( R.id.tvCommentTime );
			
			/*LinearLayout llRecord = (LinearLayout) view.findViewById( R.id.llRecord );
			TextView tvRecordTime = (TextView) view.findViewById( R.id.tvRecordTime );
			ImageView ivRecordIcon = (ImageView) view.findViewById( R.id.ivRecordIcon );*/
			AudioCommentView audioCommentView = (AudioCommentView) view.findViewById( R.id.audioCommentView );
			
			tvCommentName.setText(userComment.getUser().getName());
			tvComtContent.setText(userComment.getMessage());
			tvCommentTime.setText(TimeUtil.transTime(userComment.getDateline()));
			tvCommentName.setOnClickListener(new AvatarClickListener(userComment.getUser().getUid()));
			
			if (StringUtil.isUrl(userComment.getAudio().getAudioUrl())) {
				audioCommentView.setVisibility(View.VISIBLE);
				tvComtContent.setVisibility(View.GONE);
				audioCommentView.setAudio(userComment.getAudio());;
			}else {
				audioCommentView.setVisibility(View.GONE);
				tvComtContent.setVisibility(View.VISIBLE);
			}
			
			rlCommentOne.setOnClickListener(new ReplyCommentClickListener(map, userComment,
					userComment.getUser().getUid(), userComment.getUser().getName()));
			
			rlCommentOne.setOnLongClickListener(new CommentLongClickListener(map, userComment));
			layout.addView(view, new LayoutParams(LayoutParams.FILL_PARENT,
					LayoutParams.WRAP_CONTENT));
		}
		
		return layout;
	}
	public void setLeftPicView(final Map<String, Object> map, boolean isRepost, final int position,
			ImageView ivPic, TextView tvFname, TextView tvTvTitle,TextView tvTvContent,LinearLayout llPics,
			View view){
		view.setVisibility(View.VISIBLE);
		tvFname.setVisibility(View.GONE);
		if (((String)map.get("image_1")).contains("http://")) {
			ivPic.setVisibility(View.VISIBLE);
			
			ivPic.setImageBitmap(BitmapMgrImpl.getInstance().loadBitmap((String)map.get("image_1"), 
					ivPic, BitmapMgrImpl.getInstance().feedCallBack));
			
			ivPic.setOnClickListener(new PicClickListener(map,0));
			/*ivPic.setImageBitmap((Bitmap)map.get("image1"));*/
		}else {
			ivPic.setVisibility(View.GONE);
		}
		
		String message = (String)map.get("message");
		if (message.contains("开始时间")) {
			message = message.replaceAll("开始时间", "\n开始时间");
		}
		
		tvTvTitle.setText((String)map.get("subject"));
		tvTvContent.setText(message);
		
		if (isRepost) {
			llPics.setBackgroundResource(R.drawable.btn_lightgray);
			tvTvContent.setVisibility(View.VISIBLE);
			tvFname.setVisibility(View.VISIBLE);
			
			tvFname.setText((String)map.get("fname") +":" );
			tvTvTitle.setText((String)map.get("fsubject"));
			tvTvContent.setText((String)map.get("fmessage"));
			view.setOnClickListener(new OnClickListener() {
				@Override
				public void onClick(View v) {
					new AlertDialog.Builder(context).setItems( 
						new String[]{"原帖", (String)map.get("fname")}, new DialogInterface.OnClickListener() {
							@Override
							public void onClick(DialogInterface dialog, int which) {
								if (which == 0) {
									String idtype = (String)map.get("idtype");
									if (idtype.contains("eventid") || idtype.contains("blogid")
											|| idtype.contains("photoid") || idtype.contains("videoid")) {
										String id = (String)map.get("fid");
										if (!id.equals("")) {
											Intent intent = new Intent(context, FeedDetailActivity.class);
											intent.putExtra("id", (String)map.get("fid"));
											intent.putExtra("idtype", (String)map.get("idtype"));
											intent.putExtra("uid", (String)map.get("fuid"));
											context.startActivity(intent);
										}
									}
								}else {
									Intent intent = new Intent(context, MoreFamilyCardActivity.class);
									intent.putExtra("uid", (String)map.get("fuid"));
									context.startActivity(intent);
								}
							}
						}).create().show(); 
				}
			});
			
		}else {
			llPics.setBackgroundResource(R.drawable.btn_lightgray);
			view.setOnClickListener(new OnClickListener() {
				@Override
				public void onClick(View v) {
					String idtype = (String)map.get("idtype");
					if (idtype.contains("eventid") || idtype.contains("blogid")
							|| idtype.contains("photoid") || idtype.contains("videoid")) {
						String id = (String)map.get("id");
						if (!id.equals("")) {
							Intent intent = new Intent(context, FeedDetailActivity.class);
							intent.putExtra("id", (String)map.get("id"));
							intent.putExtra("idtype", (String)map.get("idtype"));
							intent.putExtra("uid", (String)map.get("uid"));
							intent.putExtra("position", position);
							context.startActivityForResult(intent, Constant.FEED_DELETE);
						}
					}
				}
			});
		}
	}
	public void setOnePicView(final Map<String, Object> map, boolean isRepost, final int position,
			ImageView ivPic,TextView tvTvContent,ProgressAroundView progArdView,LinearLayout llPics,
			View view){
		view.setVisibility(View.VISIBLE);
		String imgUrl = (String)map.get("image_1");
		if (DeviceInfo.SCREEN_WIDTH > 700 && imgUrl.contains("!")) {
			imgUrl = imgUrl.split("!")[0] + "!512";
		}
		//发布图片 ， 来回滚动首张图片显示不了问题（具体原因尚未查清楚）
		if (imgUrl.startsWith("/storage/sdcard0/family/image/")) {
			Bitmap bitmap = null;
			if (AbsBitmapMgr2.imageCache.containsKey(imgUrl)) {
				WeakReference<Bitmap> weakReference = AbsBitmapMgr2.imageCache.get(imgUrl);
				bitmap = weakReference != null ? weakReference.get() : null;
				if (bitmap == null) {
					AbsBitmapMgr2.imageCache.remove(imgUrl);
				}else {
				}
			}
			if (bitmap == null) {
				bitmap = BitmapTools.decode(imgUrl, 1);
				AbsBitmapMgr2.imageCache.put(imgUrl, new WeakReference<Bitmap>(bitmap));
			}
			DisplayUtil.setFeedImageLParamsByBitmap(context, ivPic, bitmap);
			ivPic.setImageBitmap(bitmap);
		}else {
			ivPic.setImageBitmap(BitmapMgrImpl2.getInstance().loadBitmap(imgUrl, 
					ivPic, new ImageCallBack() {
						@Override
						public void setImage(Bitmap bmp, String url, ImageView view) {
							if( url.equals((String)view.getTag()) && bmp != null){
								view.setScaleType(ScaleType.CENTER_CROP);
								DisplayUtil.setFeedImageLParamsByBitmap(context, view, bmp);
								view.setImageBitmap(bmp);
							}
						}
					}));
		}
		tvTvContent.setText((String)map.get("subject")); //"message"
		ivPic.setOnClickListener(new PicClickListener(map,0));

		final AudioPhoto audioPhoto = (AudioPhoto)map.get("AudioPhoto");
		if (audioPhoto != null && !audioPhoto.getAudioUrl().equals("")) {
			
			progArdView.setVisibility(View.VISIBLE);
			if (audioPhoto.isPlaying()) {
				progArdView.setImageResource(R.drawable.feed_btn_audiopause);
				progArdView.setTotalTime(SoundPlayer.getInstance().getDuration());//audioPhoto.getAudioTime()*1000);
				progArdView.setProgressAndStartTiming(SoundPlayer.getInstance().getProgress());
			}else {
				progArdView.setImageResource(R.drawable.feed_btn_audioplay);
			}
			ProgressAroundViewUtil.config(context, progArdView, audioPhoto, position);
			
		}else {
			progArdView.setVisibility(View.GONE);
		}
		
		if (isRepost) {
			llPics.setBackgroundResource(R.drawable.btn_lightgray);
			tvTvContent.setVisibility(View.VISIBLE);
			
			tvTvContent.setText(Html.fromHtml("<font color=\"#116A2A\">"
					+(String)map.get("fname") +":" + "</font>" + "<font color=\"#797979\">"
					+(String)map.get("fmessage") + "</font>" ));
			view.setOnClickListener(new OnClickListener() {
				@Override
				public void onClick(View v) {
					new AlertDialog.Builder(context).setItems( 
							new String[]{"原帖", (String)map.get("fname")}, new DialogInterface.OnClickListener() {
								@Override
								public void onClick(DialogInterface dialog, int which) {
									if (which == 0) {
										String idtype = (String)map.get("idtype");
										if (idtype.contains("eventid") || idtype.contains("blogid")
												|| idtype.contains("photoid") || idtype.contains("videoid")) {
											String id = (String)map.get("fid");
											if (!id.equals("")) {
												Intent intent = new Intent(context, FeedDetailActivity.class);
												intent.putExtra("id", (String)map.get("fid"));
												intent.putExtra("idtype", (String)map.get("idtype"));
												intent.putExtra("uid", (String)map.get("fuid"));
												context.startActivity(intent);
											}
										}
									}else {
										Intent intent = new Intent(context, MoreFamilyCardActivity.class);
										intent.putExtra("uid", (String)map.get("fuid"));
										context.startActivity(intent);
									}
								}
							}).create().show(); 
				}
			});
		}
	}
	public void setMorePicView(final Map<String, Object> map, int picnum, boolean isRepost,
			ImageView ivPics[],LinearLayout llPics,TextView tvTvContent,View view){
		view.setVisibility(View.VISIBLE);
		if (isRepost) {
			llPics.setBackgroundResource(R.drawable.btn_lightgray);
			tvTvContent.setVisibility(View.VISIBLE);
			
			tvTvContent.setText(Html.fromHtml("<font color=\"#116A2A\">"
					+(String)map.get("fname") +":" + "</font>" + "<font color=\"#797979\">"
					+(String)map.get("fmessage") + "</font>" ));
		}
		if (picnum == 4) {
			for (int i = 0,index = 0; i < ivPics.length; i++) {
				if (i < 2 || (i > 2 && i < 5) ) {
					ivPics[i].setImageBitmap(BitmapMgrImpl2.getInstance().loadBitmap((String)map.get("image_"+(++index)), 
							ivPics[i], BitmapMgrImpl2.getInstance().feedCallBack));
					
					ivPics[i].setOnClickListener(new PicClickListener(map,(index-1)));
				}else {
					ivPics[i].setVisibility(View.GONE);
				}
			}
		}else {
			for (int i = 0; i < ivPics.length; i++) {
				if (i < picnum) {
					ivPics[i].setImageBitmap(BitmapMgrImpl2.getInstance().loadBitmap((String)map.get("image_"+(i+1)), 
							ivPics[i], BitmapMgrImpl2.getInstance().feedCallBack));
					
					ivPics[i].setOnClickListener(new PicClickListener(map,i));
				}else {
					ivPics[i].setVisibility(View.GONE);
				}
			}
		}
	}
	class CommentLongClickListener implements OnLongClickListener {

		Map<String, Object> map;
		UserComment userComment;
		
		public CommentLongClickListener(Map<String, Object> map,
				UserComment userComment) {
			super();
			this.map = map;
			this.userComment = userComment;
		}

		@Override
		public boolean onLongClick(View v) {
			if (StringUtil.isUrl(userComment.getAudio().getAudioUrl())) {
				return true;//如果是语音评论 则不弹出  复制  对话框
			}
			new AlertDialog.Builder(context).setItems( 
					new String[]{"复制"}, new DialogInterface.OnClickListener() {
						@Override
						public void onClick(DialogInterface dialog, int which) {
							if (which == 0) {
								ClipboardManager clipboarManager=(ClipboardManager)context
										.getSystemService(Context.CLIPBOARD_SERVICE);
								clipboarManager.setText(userComment.getMessage().replaceAll("回复.*: ", ""));
							}
						}
					}).create().show(); 
			return true;
		}
		
	}
	class AvatarClickListener implements OnClickListener{
		String uid;
		public AvatarClickListener(String uid) {
			super();
			this.uid = uid;
		}
		@Override
		public void onClick(View v) {
			Intent intent = new Intent(context, MoreFamilyCardActivity.class);
			intent.putExtra("uid", uid);
			context.startActivity(intent);
		}
	}
	
	public interface OnRepostMenuClick {
		void onShareToWeibo(RepostFeed repostFeed);
		void onShareToWXFriend(RepostFeed repostFeed);
		void onShareToWXFriCircle(RepostFeed repostFeed);
		void onRecmdToFamily(RecomFeedMsg recomFeedMsg);
		void onRepostToFeed(RepostFeed repostFeed);
	}
	
	class postCollectFeedTask extends AsyncTask<Integer, Integer, String>{
		String jsonStr;
		Map<String, Object> map;
		TextView tvLikeitNum;
		public postCollectFeedTask(Map<String, Object> map, TextView tvLikeitNum) {
			this.map = map;
			this.tvLikeitNum = tvLikeitNum;
		}


		@Override
		protected void onPreExecute() {
			//ToastUtil.show(ctxOfActivity, tvLikeitNum.isSelected()?"收藏中...":"取消收藏中...");
			//showLoadingDialog();
			List<MapBean> loveuserMap = (List<MapBean>)map.get("loveuser");
			if (((String)map.get("mylove")).equals("0")) {
				UserInfo userInfo = UserInfo.getInstance(context);
				MapBean mapBean = new MapBean();
				mapBean.put("uid", userInfo.getUid());
				mapBean.put("name", userInfo.getName());
				mapBean.put("avatar", userInfo.getAvatarPath());
				mapBean.put("vipstatus", userInfo.getVipstatus());
				
				if (loveuserMap != null){
					loveuserMap.add(mapBean);
				}else {
					loveuserMap = new ArrayList<MapBean>();
					loveuserMap.add(mapBean);
					map.put("loveuser", loveuserMap);
				}
				map.put("mylove", "1");
			}else {
				if (loveuserMap != null && loveuserMap.size() > 0) {
					for (int i = 0; i < loveuserMap.size(); i++) {
						MapBean mapBean = loveuserMap.get(i);
						if (((String)mapBean.get("uid")).equals(UserInfo.getInstance(context).getUid())) {
							loveuserMap.remove(i);
							break;
						}
					}
				}
				map.put("mylove", "0");
			}
			notifyDataSetChanged();
			super.onPreExecute();
		}


		@Override 
		protected String doInBackground(Integer... params) {
			jsonStr = postCollectFeed(map,tvLikeitNum);
			return null;
		}
		
		protected void onPostExecute(String str){
			//hideLoadingDialog();
			if(jsonStr!= null && !"".equals(jsonStr.trim())){
				try{
					JSONObject result = new JSONObject(jsonStr);
					if(result.getInt("error") == 0){
						//map.put("mylove", tvLikeitNum.isSelected()?"1":"0");
						int love = Integer.parseInt((String)map.get("love"));
						love = ((String)map.get("mylove")).equals("1")?love+1:love-1;
						map.put("love", love<=0?0+"":love+"");
					}else {
						map.put("mylove", ((String)map.get("mylove")).equals("1")?"0":"1");
						ToastUtil.show(context, result.getString("msg"));
					}
				}catch(Exception e){
					e.printStackTrace();
				}

			}else {
				//tvLikeitNum.setSelected(tvLikeitNum.isSelected()?false:true);
				map.put("mylove", ((String)map.get("mylove")).equals("1")?"0":"1");
				TipsUtil.showUploadFailToast(context);
			}
			notifyDataSetChanged();
		}
	}
	
	private String postCollectFeed(Map<String, Object> dataMap, TextView tvLikeitNum){
		HashMap<String, String> map = new HashMap<String, String>();
	    map.put("id", (String)dataMap.get("id"));
		map.put("idtype", ((String)dataMap.get("idtype")).replace("re", ""));
		map.put("type", (String)dataMap.get("mylove"));
		map.put("m_auth", Urls.M_AUTH);
		
		List<NameValuePair> requestList = new ArrayList<NameValuePair>();
		NameValuePair item;
		
		Set<String> keySet = map.keySet();
		for (String key : keySet) {
			String value = map.get(key);
			item = new BasicNameValuePair(key, value);
			requestList.add(item);
		}
		
		return NetHelper.post(Urls.getCollectFeed(), requestList);
	}
	class postAttendActTask extends AsyncTask<Integer, Integer, String>{
		String jsonStr;
		String message;
		Map<String, Object> map;
		public postAttendActTask(Map<String, Object> map, String message) {
			super();
			this.map = map;
			this.message = message;
		}
		
		@Override
		protected void onPreExecute() {
			ToastUtil.show(context, "发送中...");
			//showLoadingDialog();
			super.onPreExecute();
		}


		@Override
		protected String doInBackground(Integer... params) {
			jsonStr = postAttendAct(map, message);
			return null;
		}
		
		protected void onPostExecute(String str){
			//hideLoadingDialog();
			if(jsonStr!= null && !"".equals(jsonStr.trim())){
				try{
					JSONObject result = new JSONObject(jsonStr);
					if(result.getInt("error") == 0){
						Toast.makeText(context, "参加成功！", Toast.LENGTH_SHORT).show();
						int replynum = Integer.parseInt((String)map.get("replynum"));
						map.put("replynum", replynum+1+"");
						
						notifyDataSetChanged();
					}else {
						ToastUtil.show(context, result.getString("msg"));
					}
				}catch(Exception e){
					e.printStackTrace();
				}

			}else {
				TipsUtil.showUploadFailToast(context);
			}
		}
	}
	private String postAttendAct(Map<String, Object> dataMap, String message){
		HashMap<String, String> map = new HashMap<String, String>();
	    map.put("id", (String)dataMap.get("id"));
		map.put("idtype", "eventid");
		map.put("message", "参与了活动");
		map.put("come", "android");
		map.put("m_auth", Urls.M_AUTH);
		
		List<NameValuePair> requestList = new ArrayList<NameValuePair>();
		NameValuePair item;
		
		Set<String> keySet = map.keySet();
		for (String key : keySet) {
			String value = map.get(key);
			item = new BasicNameValuePair(key, value);
			requestList.add(item);
		}
		
		return NetHelper.post(Urls.getAttendAct(), requestList);
	}
	
	class PicClickListener implements OnClickListener{
		Map<String, Object> map;
		int showIndex;
		public PicClickListener(Map<String, Object> map,int showIndex) {
			super();
			this.map = map;
			this.showIndex = showIndex;
		}
		@Override
		public void onClick(View v) {
			Intent intent = new Intent(context, FeedImageActivity.class);
			//intent.putExtra("picurl", (String)map.get("pic"));
			intent.putExtra("uid", (String)map.get("uid"));
			intent.putExtra("idtype", (String)map.get("idtype"));
			intent.putExtra("showIndex", showIndex);
			intent.putExtra("photoid",  (String)map.get("id"));
			intent.putExtra("message", (String)map.get("message"));
			intent.putExtra("isPublish", (String)map.get("isPublish"));
			ArrayList<String> photoUrls = new ArrayList<String>();
			if (((String)map.get("isPublish")) != null) {
				for (int i = 0; i < 9; i++) {
					if (((String)map.get("image_"+i)) != null && !((String)map.get("image_"+i)).equals("")) {
						photoUrls.add((String)map.get("image_"+i));
					}
				}
			}else {
				for (int i = 1; i <= 9; i++) {
					if(((String)map.get("image_"+i)).contains("http://")){
						photoUrls.add(((String)map.get("image_"+i)).replaceAll("!.*", "!600"));
					}
				}
			}
			intent.putExtra("AudioPhoto", (AudioPhoto)map.get("AudioPhoto"));
			intent.putStringArrayListExtra("photoUrls", photoUrls);;
			context.startActivity(intent);
			context.overridePendingTransition(R.anim.alpha_low_up,R.anim.alpha_up_low);
		}
	}
	class postDeleteDetailTask extends AsyncTask<Integer, Integer, String>{
		String jsonStr;
		String idtype;
		String id;
		int position;
		
		public postDeleteDetailTask(String idtype, String id, int position) {
			super();
			this.idtype = idtype;
			this.id = id;
			this.position = position;
		}


		@Override
		protected void onPreExecute() {
			//showLoadingDialog();
			ToastUtil.show(context, "删除");
			mListItems.remove(position);
			notifyDataSetChanged();
			super.onPreExecute();
		}


		@Override
		protected String doInBackground(Integer... params) {
			jsonStr = postDeleteDetail(idtype, id);
			return null;
		}
		
		protected void onPostExecute(String str){
			//hideLoadingDialog();
			if(jsonStr!= null && !"".equals(jsonStr.trim())){
				try{
					JSONObject result = new JSONObject(jsonStr);
					if(result.getInt("error") == 0){
						ToastUtil.show(context, "删除帖子成功！");
					}else {
						ToastUtil.show(context, result.getString("msg"));
					}
				}catch(Exception e){
					e.printStackTrace();
				}
			}else {
				TipsUtil.showUploadFailToast(context);
			}
		}
	}
	
	private String postDeleteDetail(String idtype, String id){
		String acType = idtype.replace("re", "").replace("id", "");
		
		HashMap<String, String> map = new HashMap<String, String>();
	    map.put(acType + "id", id);
		map.put("deletesubmit", "1");
		map.put("m_auth", Urls.M_AUTH);
		
		List<NameValuePair> requestList = new ArrayList<NameValuePair>();
		NameValuePair item;
		
		Set<String> keySet = map.keySet();
		for (String key : keySet) {
			String value = map.get(key);
			item = new BasicNameValuePair(key, value);
			requestList.add(item);
		}
		
		return NetHelper.post(Urls.getDeleteDetail(acType), requestList);
	}
	class ReplyCommentClickListener implements OnClickListener{
		Map<String, Object> map;
		String authorid;
		String authorname;
		UserComment userComment;
		
		public ReplyCommentClickListener(Map<String, Object> map, UserComment userComment, 
				String authorid, String authorname) {
			super();
			this.map = map;
			this.authorid = authorid;
			this.authorname = authorname;
			this.userComment = userComment;
		}
		@Override
		public void onClick(View v) {
			if (UserInfo.getInstance(context).getUid().equals(authorid)) {
				if (userComment.getCid() != null && !userComment.getCid().equals("")) {
					new AlertDialog.Builder(context).setItems( 
							new String[]{"删除"}, new DialogInterface.OnClickListener() {
								@Override
								public void onClick(DialogInterface dialog, int which) {
									if (which == 0) {
										FeedDelCmtTask.postDelete(context, userComment.getCid(), (String)map.get("uid"), 
												authorid, new OnTaskListener(){
													@Override
													public void onPre() {
														ArrayList<UserComment> userComments 
															= (ArrayList<UserComment>) map.get("UserCommentList");
														if (userComments != null) {
															userComments.remove(userComment);
														}
														notifyDataSetChanged();
													}
	
													@Override
													public void onPost(String result) {
													}
										}); 
									}
								}
							}).create().show();
					return;
				}else {
					return;
				}
			}
			 
			
			String hint = "随便说点啥吧...";
			final boolean isReply;
			if (!UserInfo.getInstance(context).getUid().equals(authorid)) {
				hint = "回复"+authorname+": ";
				isReply = true;
			}else {
				isReply = false;
			}
			if (onCommentInterface != null) {
				onCommentInterface.onReplyComment(map, userComment, 
						hint, userComment.getReplyCacheMsg());
				return;
			}
			final EditText editText = new EditText(context);
			   editText.setHint(hint);
			   editText.setGravity(Gravity.TOP);
			   editText.setHeight(DisplayUtil.dip2px(context, 188));
			   editText.setBackgroundColor(Color.parseColor("#00000000"));
			   editText.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
			   editText.setTextSize(16);
			   CustomDialog dialog = new CustomDialog.Builder(context).setView(editText)
					   .setNegativeButton("", null)
					   .setPositiveButton("", new DialogInterface.OnClickListener() {
						@Override
						public void onClick(DialogInterface dialog, int which) {
							String message = editText.getText().toString().trim();
							if (!message.equals("")) {
								message = (isReply?"回复"+authorname+": ":"") + message;
								new postCommentTask(map,message).execute();
							}else {
								ToastUtil.show(context, R.string.dialog_hint_comment);
							}
						}
					}).create();
			   dialog.setOnShowListener(new DialogInterface.OnShowListener() {

				    @Override
				    public void onShow(DialogInterface dialog) {
				        InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
				        if (imm != null) {
				        	imm.showSoftInput(editText, InputMethodManager.SHOW_IMPLICIT);
						}
				    }
				});
			
			dialog.show();
		} 
		}
	private String postComment(Map<String, Object> dataMap, String message, int soundid){
		HashMap<String, String> map = new HashMap<String, String>();
	    map.put("id", (String)dataMap.get("id"));
		map.put("idtype", ((String)dataMap.get("idtype")).replace("re", ""));
		map.put("message", message);
		map.put("soundid", soundid<=0?"":soundid+"");
		map.put("m_auth", Urls.M_AUTH);
		
		List<NameValuePair> requestList = new ArrayList<NameValuePair>();
		NameValuePair item;
		
		Set<String> keySet = map.keySet();
		for (String key : keySet) {
			String value = map.get(key);
			item = new BasicNameValuePair(key, value);
			requestList.add(item);
		}
		
		return NetHelper.post(Urls.getComment(), requestList);
	}
	class postCommentTask extends AsyncTask<Integer, Integer, String>{
		String jsonStr;
		String message;
		float soundtime; 
		String soundpath;
		Map<String, Object> map;
		public postCommentTask(Map<String, Object> map, String message) {
			super();
			this.map = map;
			this.message = message;
		}
		
		public postCommentTask(Map<String, Object> map, String message, 
				float soundtime, String soundpath) {
			super();
			this.map = map;
			this.message = message;
			this.soundtime = soundtime;
			this.soundpath = soundpath;
		}
		
		@Override
		protected void onPreExecute() {
			ToastUtil.show(context, "发送中...");

			int replynum = Integer.parseInt((String)map.get("replynum"));
			map.put("replynum", replynum+1+"");
			map.put("commentnum", (Integer)map.get("commentnum") + 1);
			
			ArrayList<UserComment> userComments = (ArrayList<UserComment>) map.get("UserCommentList");
			if (userComments == null) {
				userComments = new ArrayList<UserComment>();
			}
			
			UserComment userComment;
			userComment = new UserComment();
			userComment.getUser().setUid(UserInfo.getInstance(context).getUid());
			userComment.getUser().setName(UserInfo.getInstance(context).getName());
			userComment.setCid("");
			userComment.setMessage(message);
			userComment.setDateline(new Date().getTime()/1000L);
			userComment.getAudio().setAudioTime(soundtime);
			userComment.getAudio().setAudioPath(soundpath);
			if (soundpath!=null && !soundpath.equals("")) {
				String fakeUrl = "http://file-pic.fake.com/fake"
					    + UUID.randomUUID().toString() +".amr";
				SoundMgr.getInstance().addSoundCache(fakeUrl, soundpath);
				userComment.getAudio().setAudioUrl(fakeUrl);
			}
			
			userComments.add(0,userComment);
			
			map.put("UserCommentList", userComments);
			
			notifyDataSetChanged();
			super.onPreExecute();
		}


		@Override
		protected String doInBackground(Integer... params) {
			int soundid = -1;
			if (soundpath!=null && !soundpath.equals("")) {
				jsonStr = HttpService.uploadSound(soundtime, soundpath);
				soundid = getSoundid(jsonStr);
			}
			
			jsonStr = postComment(map, message, soundid);
			return null;
		}
		
		private int getSoundid(String jsonStr) {
			System.out.println(jsonStr);
			int soundid = -1;
			if (jsonStr != null && !jsonStr.equals("")) {
				try{
					JSONObject resultData = new JSONObject(jsonStr);
					int error = resultData.getInt("error");
					if(error == 0){
						JSONObject jsonObj = resultData.getJSONObject("data");
						soundid = jsonObj.getInt("soundid");
					}
				}catch(Exception e){
					e.printStackTrace();
				}
			}
			return soundid;
		}
		
		protected void onPostExecute(String str){
			//hideLoadingDialog();
			if(jsonStr!= null && !"".equals(jsonStr.trim())){
				try{
					JSONObject result = new JSONObject(jsonStr);
					if(result.getInt("error") == 0){
						result = result.getJSONObject("data");
						String cid = result.getString("cid");
						((ArrayList<UserComment>)map.get("UserCommentList")).get(0).setCid(cid);
						Toast.makeText(context,"评论成功！", Toast.LENGTH_SHORT).show();
					}else {
						ToastUtil.show(context, result.getString("msg"));
					}
				}catch(Exception e){
					e.printStackTrace();
				}

			}else {
				TipsUtil.showUploadFailToast(context); 
			}
		}
	}
	 class ViewHolderRoot{
			public  LinearLayout llFeedDate;
			public TextView tvFeedDate;
			public TextView tvNoticeNum;
			public ImageView ivAvatar;
			public ImageView ivVip;
			public RelativeLayout rlUserInfo;
			public TextView tvTvUserName;
			public TextView tvTvTime;
			public CollapsibleTextView tvTvContent;
			public TextView tvNewNum;
			
			TextView    tvDetail;
			TextView    tvDelete;
			TextView    tvFeedTittle;
			LinearLayout llRepostPart;
			TextView    tvTvFname;
			TextView    tvFoldState ;
			LinearLayout llLlContent;
			TextView    tvCome ;
			RelativeLayout rlMoreMenu;
			LinearLayout llAlbumName;
			TextView    tvTvAlbumName ;
			ImageView 	ivIvShowMore;
			LinearLayout llLlHidedMenu;
			TextView    tvRepostNum ;
			TextView    tvLikeitNum ;
			TextView    tvCommentNum ;
			TextView    tvTvLoveUsers ;
			TextView    tvCommentMark ;
			LinearLayout    llSplitLine ;
			LinearLayout llLlComments ;
			
		}
		 class ViewHolder_0 extends ViewHolderRoot {
			// 
			
			
		}
		class ViewHolder_1 extends ViewHolderRoot {
			// notice
			ImageView ivPic;
			TextView tvItemFname;
			TextView tvTvTitle;
			TextView tvItemContent;
			LinearLayout llPics;
		}
		class ViewHolder_2 extends ViewHolderRoot {
			// pic 1
			ImageView 	ivPic;
			TextView  	tvItemContent;
			LinearLayout llPics;
			ProgressAroundView progArdView;
			
		}
		class ViewHolder_3 extends ViewHolderRoot {
			// picmore
			ImageView ivPics1;
			ImageView ivPics2;
			ImageView ivPics3;
			ImageView ivPics4;
			ImageView ivPics5;
			ImageView ivPics6;
			ImageView ivPics7;
			ImageView ivPics8;
			ImageView ivPics9;
			ImageView ivpics[];
			LinearLayout llPics;
			TextView tvItemContent;
		}
//		class ViewHolder_4 extends ViewHolderRoot {
//			// pic 1
//			ImageView 	ivPic;
//			TextView  	tvItemContent;
//			LinearLayout llPics;
//			ProgressAroundView progArdView;
//			
//		}
		class ViewHolder_5 extends ViewHolderRoot {
			// 
			// left_one
			ImageView ivPic ;
			TextView tvItemFname ;
			TextView tvTvTitle ;;
			TextView tvItemContent;;
			LinearLayout llPics ;
			ImageView ivComtPhoto;
		}
}